import React, { useState } from 'react';
import { AxLayout } from '@/components/AxBase';
import AxPageHeaderWrapper from '@/components/AxBase/AxPageHeaderWrapper';
import Type from './components/type';
import Item from './components/item';

const Index: React.FC<any> = props => {
    const [currentTypeData, setcurrentTypeData] = useState<any>();

    const handleSelectLeft = (rows: any) => {
        setcurrentTypeData(rows && rows[0] || {});
    }

    return (
        <AxLayout
            gutter={6}
            west={{
                span: 6,
                children: (
                    <Type
                        handleSelectLeft={handleSelectLeft}
                    />
                ),
            }}
            center={{
                span: 18,
                items: {
                    north: {
                        children: (
                            <Item
                                currentTypeData={currentTypeData}
                            />
                        )
                    }
                },
            }}
        />
    );
};

export default Index;
